#!/bin/sh

fusermount="/usr/bin/fusermount"
fusermount_option=
mountpoint=$1; shift 1

while getopts "lv" OPTION
do
  case $OPTION in
    l)
      fusermount_option="-z"
    ;;
    v)
    ;;
    ?)
      echo "Invalid option"
      exit 1
    ;;
  esac
done

sed -i "s|^cvmfs2 $mountpoint cvmfs \(.*\)|cvmfs2 $mountpoint fuse \1|" /etc/mtab
$fusermount -u $fusermount_option $mountpoint

retval=$?

exit $retval

